﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sinacor.Servico.Infra.FileTransfer.Service.DataContract.Response;
using Sinacor.Servico.Infra.FileTransfer.BusinessEntity;

namespace Sinacor.Servico.Infra.FileTransfer.Service.ServiceImplementation.Translator.BusinessEntityToDataContract
{
    public class FileRepositoryService
    {
        public static FileInfoResponse ToFileInfoResponse(FileInfoEntity fileInfoEntity)
        {
            FileInfoResponse fileInfoResponse = new FileInfoResponse();
            fileInfoResponse.FileName = fileInfoEntity.FileName;
            fileInfoResponse.DataStream = fileInfoEntity.DataStream;
            return fileInfoResponse;
        }

        public static StorageFileInfoResponse ToStorageFileInfoResponse(FileInfoEntity fileInfoEntity)
        {
            StorageFileInfoResponse storageFileInfoResponse = new StorageFileInfoResponse();
            storageFileInfoResponse.VirtualPath = fileInfoEntity.FileName;
            storageFileInfoResponse.Size = fileInfoEntity.Size;
            return storageFileInfoResponse;
        }

        public static List<StorageFileInfoResponse> ToStorageFileInfoResponse(List<FileInfoEntity> fileInfoEntity)
        {
            List<StorageFileInfoResponse> storageFileInfoResponse = new List<StorageFileInfoResponse>();

            foreach (FileInfoEntity entity in fileInfoEntity)
            {
                storageFileInfoResponse.Add(ToStorageFileInfoResponse(entity));
            }

            return storageFileInfoResponse;
        }
    }
}
